package com.design.design.pattern.structural.decorator.v2GoodDecorator;


/**
 * @author TomDragon
 *
 * 抽像装饰类和具体实体类ButterCake 都是抽象实体类
 * 的子类，这个抽象装饰者类需要和具体实体类建立关系，
 * 通过构造函数注入 + 向上造型
 */
public abstract class AbstractDecorator extends AbstractButterCake {

    /**
     * 将 AbstractButterCake 组合进来
     */
    private AbstractButterCake abstractButterCake;

    public AbstractDecorator(AbstractButterCake abstractButterCake) {
        this.abstractButterCake = abstractButterCake;
    }

    protected abstract void doSomething();


    @Override
    protected String getDesc() {
        return this.abstractButterCake.getDesc();
    }

    @Override
    protected int cost() {
        return this.abstractButterCake.cost();
    }
}
